package com.matt.domain.statistics;

import com.matt.foundation.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/7/20
 * 续约客户统计，每天定时任务更新，如果今天有待续约客户则纪录，如果有预约合同了，则置为已续约
 * *******************************
 */
@Data
@Entity
@Table(name = "stat_renewal_clientele")
@EqualsAndHashCode(callSuper = true)
public class StatRenewalClientele extends Domain{
    @Column(columnDefinition = "varchar(32)  COMMENT '对应客户id'")
    private String clienteleId;

    @Column(columnDefinition = "varchar(32)  COMMENT '对应合同id'")
    private String contractId;

    @Column(columnDefinition = "int default 1  COMMENT '1：托班，2：早教'")
    private Integer type;

    @Column(columnDefinition = "bit default false  COMMENT 'false：待续约，true：已续约'")
    private Boolean isRenewed;

    @Column(columnDefinition = " datetime  COMMENT '续约时间' ")
    private Date renewalDate;

    @Column(columnDefinition = "varchar(32) COMMENT '所属园区'")
    private String areaId;

    public static StatRenewalClientele of(String clienteleId, String contractId, Integer type, Boolean isRenewed, String areaId){
        StatRenewalClientele stat = new StatRenewalClientele();
        stat.setClienteleId(clienteleId);
        stat.setContractId(contractId);
        stat.setType(type);
        stat.setIsRenewed(isRenewed);
        stat.setAreaId(areaId);
        return stat;
    }
}
